using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.H_MessageTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HL_MessageTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HL_MessageTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HL_Message";
			dataTableMapping.ColumnMappings.Add("MessageID", "MessageID");
			dataTableMapping.ColumnMappings.Add("Sender", "Sender");
			dataTableMapping.ColumnMappings.Add("Receiver", "Receiver");
			dataTableMapping.ColumnMappings.Add("Title", "Title");
			dataTableMapping.ColumnMappings.Add("Content", "Content");
			dataTableMapping.ColumnMappings.Add("DelR", "DelR");
			dataTableMapping.ColumnMappings.Add("SendTime", "SendTime");
			dataTableMapping.ColumnMappings.Add("DelS", "DelS");
			dataTableMapping.ColumnMappings.Add("IsSend", "IsSend");
			dataTableMapping.ColumnMappings.Add("IsRead", "IsRead");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HL_Message] WHERE (([MessageID] = @Original_MessageID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_MessageID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HL_Message] ([Sender], [Receiver], [Title], [Content], [DelR], [SendTime], [DelS], [IsSend], [IsRead]) VALUES (@Sender, @Receiver, @Title, @Content, @DelR, @SendTime, @DelS, @IsSend, @IsRead)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Sender", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Sender", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Receiver", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Receiver", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Content", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Content", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@DelR", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "DelR", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@SendTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "SendTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@DelS", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "DelS", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@IsSend", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "IsSend", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@IsRead", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "IsRead", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HL_Message] SET [Sender] = @Sender, [Receiver] = @Receiver, [Title] = @Title, [Content] = @Content, [DelR] = @DelR, [SendTime] = @SendTime, [DelS] = @DelS, [IsSend] = @IsSend, [IsRead] = @IsRead WHERE (([MessageID] = @Original_MessageID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Sender", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Sender", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Receiver", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Receiver", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Content", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Content", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@DelR", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "DelR", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@SendTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "SendTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@DelS", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "DelS", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsSend", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "IsSend", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsRead", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "IsRead", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_MessageID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[11];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT MessageID, Sender, Receiver, Title, Content, DelR, SendTime, DelS, IsSend, \r\n      IsRead\r\nFROM HL_Message";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "DELETE FROM [HL_Message] WHERE (([MessageID] = @MessageID))";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@MessageID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "SELECT MessageID, Sender, Receiver, Title, DelR, SendTime, DelS, IsSend, \r\n      IsRead\r\nFROM HL_Message\r\nOrder By MessageID desc";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT Content, DelR, DelS, IsRead, IsSend, MessageID, Receiver, SendTime, Sender, Title FROM HL_Message WHERE (MessageID = @MessageID)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@MessageID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4] = new SqlCommand();
			this._commandCollection[4].Connection = this.Connection;
			this._commandCollection[4].CommandText = "\r\n                      SELECT HL_Message.MessageID, HL_Message.Sender,HL_Message.Receiver,HL_Message.IsRead,HL_Message.IsSend,\r\n                      HL_Message.Title,HL_Message.SendTime,  HL_User.UserID,HL_User.UserName\r\n                      FROM HL_Message Left JOIN\r\n                      HL_User ON HL_User.UserName=HL_Message.Sender\r\n                      WHERE (HL_Message.Receiver = @Receiver) AND (HL_Message.DelR = 0) Order By HL_Message.MessageID Desc, HL_Message.IsRead asc\r\n                    ";
			this._commandCollection[4].CommandType = CommandType.Text;
			this._commandCollection[4].Parameters.Add(new SqlParameter("@Receiver", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "Receiver", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[5] = new SqlCommand();
			this._commandCollection[5].Connection = this.Connection;
			this._commandCollection[5].CommandText = "\r\n                      SELECT HL_Message.MessageID, HL_Message.Sender,HL_Message.Receiver,HL_Message.IsRead,HL_Message.IsSend,\r\n                      HL_Message.Title,HL_Message.SendTime,  HL_User.UserID,HL_User.UserName\r\n                      FROM HL_Message inner JOIN\r\n                      HL_User ON HL_User.UserName=HL_Message.Receiver\r\n                      WHERE (HL_Message.Sender = @Sender) AND (HL_Message.DelS = 0) Order By HL_Message.MessageID Desc, HL_Message.IsRead asc\r\n                    ";
			this._commandCollection[5].CommandType = CommandType.Text;
			this._commandCollection[5].Parameters.Add(new SqlParameter("@Sender", SqlDbType.VarChar, 30, ParameterDirection.Input, 0, 0, "Sender", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[6] = new SqlCommand();
			this._commandCollection[6].Connection = this.Connection;
			this._commandCollection[6].CommandText = "\r\n                      SELECT COUNT(MessageID) FROM HL_Message\r\n                      WHERE Receiver=@UserName AND IsSend=1 AND IsRead=0 And DelR=0";
			this._commandCollection[6].CommandType = CommandType.Text;
			this._commandCollection[6].Parameters.Add(new SqlParameter("@UserName", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "Receiver", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7] = new SqlCommand();
			this._commandCollection[7].Connection = this.Connection;
			this._commandCollection[7].CommandText = "INSERT INTO [HL_Message] ([Sender], [Receiver], [Title], [Content], [DelR],   [DelS], [IsSend], [IsRead]) VALUES (@Sender, @Receiver, @Title, @Contents, @DelR, @DelS, @IsSend, @IsRead)";
			this._commandCollection[7].CommandType = CommandType.Text;
			this._commandCollection[7].Parameters.Add(new SqlParameter("@Sender", SqlDbType.VarChar, 30, ParameterDirection.Input, 0, 0, "Sender", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@Receiver", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "Receiver", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@Contents", SqlDbType.VarChar, 1500, ParameterDirection.Input, 0, 0, "Content", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@DelR", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "DelR", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@DelS", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "DelS", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@IsSend", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "IsSend", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[7].Parameters.Add(new SqlParameter("@IsRead", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "IsRead", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[8] = new SqlCommand();
			this._commandCollection[8].Connection = this.Connection;
			this._commandCollection[8].CommandText = "UPDATE [HL_Message] SET [DelR] =1 WHERE (([MessageID] = @MessageID))";
			this._commandCollection[8].CommandType = CommandType.Text;
			this._commandCollection[8].Parameters.Add(new SqlParameter("@MessageID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[9] = new SqlCommand();
			this._commandCollection[9].Connection = this.Connection;
			this._commandCollection[9].CommandText = "UPDATE [HL_Message] SET  [DelS] =1 WHERE (([MessageID] = @MessageID))";
			this._commandCollection[9].CommandType = CommandType.Text;
			this._commandCollection[9].Parameters.Add(new SqlParameter("@MessageID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[10] = new SqlCommand();
			this._commandCollection[10].Connection = this.Connection;
			this._commandCollection[10].CommandText = "UPDATE [HL_Message] SET  IsRead  = 1 WHERE (([MessageID] = @Original_MessageID))";
			this._commandCollection[10].CommandType = CommandType.Text;
			this._commandCollection[10].Parameters.Add(new SqlParameter("@Original_MessageID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "MessageID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Message.HL_MessageDataTable GetMessages()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			H_Message.HL_MessageDataTable hL_MessageDataTable = new H_Message.HL_MessageDataTable();
			this.Adapter.Fill(hL_MessageDataTable);
			return hL_MessageDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Message.HL_MessageDataTable GetMessageList()
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			H_Message.HL_MessageDataTable hL_MessageDataTable = new H_Message.HL_MessageDataTable();
			this.Adapter.Fill(hL_MessageDataTable);
			return hL_MessageDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Message.HL_MessageDataTable GetMessageByMessageID(int MessageID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			this.Adapter.SelectCommand.Parameters[0].Value = MessageID;
			H_Message.HL_MessageDataTable hL_MessageDataTable = new H_Message.HL_MessageDataTable();
			this.Adapter.Fill(hL_MessageDataTable);
			return hL_MessageDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Message.HL_MessageDataTable GetReceiverMessage(string Receiver)
		{
			this.Adapter.SelectCommand = this.CommandCollection[4];
			if (Receiver == null)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = Receiver;
			}
			H_Message.HL_MessageDataTable hL_MessageDataTable = new H_Message.HL_MessageDataTable();
			this.Adapter.Fill(hL_MessageDataTable);
			return hL_MessageDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Message.HL_MessageDataTable GetSenderMessage(string Sender)
		{
			this.Adapter.SelectCommand = this.CommandCollection[5];
			if (Sender == null)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = Sender;
			}
			H_Message.HL_MessageDataTable hL_MessageDataTable = new H_Message.HL_MessageDataTable();
			this.Adapter.Fill(hL_MessageDataTable);
			return hL_MessageDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Message.HL_MessageDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Message dataSet)
		{
			return this.Adapter.Update(dataSet, "HL_Message");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteMessage(int MessageID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			sqlCommand.Parameters[0].Value = MessageID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual object GetUnreadMsgByUserName(string UserName)
		{
			SqlCommand sqlCommand = this.CommandCollection[6];
			if (UserName == null)
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = UserName;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			object obj;
			try
			{
				obj = sqlCommand.ExecuteScalar();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			object result;
			if (obj == null || obj.GetType() == typeof(System.DBNull))
			{
				result = null;
			}
			else
			{
				result = obj;
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Insert, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int InsertMessage(string Sender, string Receiver, string Title, string Contents, int? DelR, int? DelS, int? IsSend, int? IsRead)
		{
			SqlCommand sqlCommand = this.CommandCollection[7];
			if (Sender == null)
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = Sender;
			}
			if (Receiver == null)
			{
				sqlCommand.Parameters[1].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[1].Value = Receiver;
			}
			if (Title == null)
			{
				sqlCommand.Parameters[2].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[2].Value = Title;
			}
			if (Contents == null)
			{
				sqlCommand.Parameters[3].Value = System.DBNull.Value;
			}
			else
			{
				sqlCommand.Parameters[3].Value = Contents;
			}
			if (DelR.HasValue)
			{
				sqlCommand.Parameters[4].Value = DelR.Value;
			}
			else
			{
				sqlCommand.Parameters[4].Value = System.DBNull.Value;
			}
			if (DelS.HasValue)
			{
				sqlCommand.Parameters[5].Value = DelS.Value;
			}
			else
			{
				sqlCommand.Parameters[5].Value = System.DBNull.Value;
			}
			if (IsSend.HasValue)
			{
				sqlCommand.Parameters[6].Value = IsSend.Value;
			}
			else
			{
				sqlCommand.Parameters[6].Value = System.DBNull.Value;
			}
			if (IsRead.HasValue)
			{
				sqlCommand.Parameters[7].Value = IsRead.Value;
			}
			else
			{
				sqlCommand.Parameters[7].Value = System.DBNull.Value;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Update, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int SetMessageDelR(int MessageID)
		{
			SqlCommand sqlCommand = this.CommandCollection[8];
			sqlCommand.Parameters[0].Value = MessageID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Update, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int SetMessageDelS(int MessageID)
		{
			SqlCommand sqlCommand = this.CommandCollection[9];
			sqlCommand.Parameters[0].Value = MessageID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Update, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int SetMessageIsRead(int Original_MessageID)
		{
			SqlCommand sqlCommand = this.CommandCollection[10];
			sqlCommand.Parameters[0].Value = Original_MessageID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
